
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 04/05/2015 08:45:12
-- Generated from EDMX file: C:\Users\Marco\Documents\Visual Studio 2013\Projects\oplaco samples\Oplaco.AzureStorageSample\Oplaco.Samples.Repository\OplacoModelEntities.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [oplSamplesDb];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[oplArticle]', 'U') IS NOT NULL
    DROP TABLE [dbo].[oplArticle];
GO
IF OBJECT_ID(N'[dbo].[oplArticleImages]', 'U') IS NOT NULL
    DROP TABLE [dbo].[oplArticleImages];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'oplArticles'
CREATE TABLE [dbo].[oplArticles] (
    [Id] int  NOT NULL,
    [Title] nvarchar(50)  NOT NULL,
    [LastModified] datetime  NOT NULL
);
GO

-- Creating table 'oplArticleImages'
CREATE TABLE [dbo].[oplArticleImages] (
    [Id] int  NOT NULL,
    [FileName] nvarchar(max)  NULL,
    [Url] nvarchar(max)  NOT NULL,
    [Alias] nvarchar(max)  NOT NULL,
    [ArticleId] int  NOT NULL,
    [LastModified] datetime  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'oplArticles'
ALTER TABLE [dbo].[oplArticles]
ADD CONSTRAINT [PK_oplArticles]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'oplArticleImages'
ALTER TABLE [dbo].[oplArticleImages]
ADD CONSTRAINT [PK_oplArticleImages]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------